<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/12/14/014
 * Time: 16:27
 */

namespace app\api\controller\v1;


use app\api\controller\BaseController;
use app\api\validate\MemberValidate;
use app\api\validate\NoteCodeValidate;
use app\api\model\Member as MemberModel;
use app\api\service\NoteCode as NoteCodeModel;
use app\lib\exception\SuccessMessage;

class Set extends BaseController {

    // 设置安全密码
    public function setSafePassword() {
//        $code, $mobile, $safe_password
//        (new NoteCodeValidate())->goCheck();
        $memberValidate = new MemberValidate();
        $memberValidate->goCheck('safe_password');

        $code = input('param.code');
        $mobile = input('param.mobile');
        $safe_password = input('param.safe_password');

        NoteCodeModel::VerificationCode(['code' => $code, 'mobile' => $mobile]);

        MemberModel::setSafePassword($safe_password, $mobile);
        return json(new SuccessMessage(), 201);
    }
}